home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Utilities / Random / Commodore 64c / SOURCE / Tape.c < prev    next >
Text File  |  1994-03-19  |  1KB  |  48 lines

  1. /*
  2.     Commodore 64 Emulator v0.2      Earle F. Philhower III 
  3.     Copyright (C) 1993-4            (st916w9r@dunx1.ocs.drexel.edu)
  4.  
  5.     This program is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation; either version 2 of the License, or
  8.     (at your option) any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19. #include "ProcessorTypes.h"
  20. #include "Memory.h"
  21.  
  22. void LoadTapeFS(FSSpec *spec)
  23. {
  24.     short fNum;
  25.     unsigned long len;
  26.     byte data;
  27.     word addr;
  28.             
  29.     FSpOpenDF(spec, fsRdPerm, &fNum);
  30.     SetFPos(fNum, fsFromStart, 0x42);
  31.     len=1; FSRead(fNum, &len, &data); addr=data;
  32.     len=1; FSRead(fNum, &len, &data); addr+=((word)data)<<8;
  33.     
  34.     SetFPos(fNum, fsFromStart, 0x0400);
  35.     len=1;
  36.     while (len) FSRead(fNum, &len, &(RAM[addr++]));
  37.     FSClose(fNum);
  38. }
  39.  
  40.  
  41. void LoadTape(void)
  42. {
  43.     static StandardFileReply reply;
  44.             
  45.     StandardGetFile(nil, (short)-1, nil, &reply);
  46.     if (reply.sfGood) LoadTapeFS(&reply.sfFile);
  47. }
  48.